import os
from shutil import copyfile

video_path = r"D:\数据集\无人机数据集\红外和RGB视频数据集\Drone-detection-dataset-master\Drone-detection-dataset-master\Data\Video_V"
target_dir = r"E:\uav_datasets\Drone_detection_dataset"

# 复制文件到target_dir
for file_name in os.listdir(video_path):
    origin_name, ext = os.path.splitext(file_name)
    if ext == ".mp4":  # 筛选mp4文件
        cls = origin_name.split("_")[1]
        copyfile(os.path.join(video_path, file_name),
                 os.path.join(target_dir, cls, file_name))
